const colors = document.querySelectorAll('.color');

colors.forEach(color => { 
  color.addEventListener('click', () => { 
    // 获取最终样式
    const colorValue = window.getComputedStyle(color).backgroundColor;
 
    // 获取当前活动标签页
    chrome.tabs.query({ active: true, lastFocusedWindow: true }, (tabs) => { 
      const tab = tabs[0];

      // 传递消息到content.js
      chrome.tabs.sendMessage(tab.id, { color: colorValue }, (response) => { 
        console.log(response);
      });
    })
  })
})